# -*- coding: utf-8 -*-

import scrapy
from scrapy.pipelines.images import ImagesPipeline

class FangtianxiaImagesPipeline(ImagesPipeline):
    def get_media_requests(self, item, info):
        for urls in item.get('image_urls'):
            yield scrapy.Request('https:'+urls)

    def file_path(self, request, response=None, info=None):
        pass

class NormalPipeLine(object):
    def process_item(self,item,spider):
        Proj_Categary = item.get('Proj_Categary')
        Proj_Loc = item.get('Proj_Loc')
        Proj_Price = item.get('Proj_Price')
        url = item.get('image_urls')
        print(url)

        with open(r'E:\note\spider\项目\fangtianxia\fangtianxia\proj_info.txt','a',encoding='utf-8') as f:
            for i in range(len(Proj_Categary)):
                name = Proj_Categary[i].strip()
                pri = Proj_Price[i]
                loc = Proj_Loc[i]
                f.writelines([name,' '*20,pri,' '*20,loc,'\n'])
